From: Florian Müllner Date: Fri, 2 Sep 2011 12:15:31 +0000 (+0200) Subject: user-menu: Keep track of current presence X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~7821 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8adc193d73de613d8f7bf7a2bf9213d17e40fabd;p=gnome-shell.git user-menu: Keep track of current presence We keep track of presence changes by connecting to the Tp.AccountManager:most-available-presence-changed signal. However, if multiple accounts are in use, telepathy may lie to us and emit the signal even when the most available presence is unchanged. Work around this by keeping track of the current presence ourselves. https://bugzilla.gnome.org/show_bug.cgi?id=657703 --- diff --git a/js/ui/userMenu.js b/js/ui/userMenu.js index 115bcf7c1..d5349bae2 100644 --- a/js/ui/userMenu.js +++ b/js/ui/userMenu.js @@ -170,6 +170,7 @@ IMStatusChooserItem.prototype = { this._presence.connect('StatusChanged', Lang.bind(this, this._sessionStatusChanged)); + this._currentPresence = undefined; this._previousPresence = undefined; this._accountMgr = Tp.AccountManager.dup() @@ -267,6 +268,11 @@ IMStatusChooserItem.prototype = { }, _IMStatusChanged: function(accountMgr, presence, status, message) { + if (presence == this._currentPresence) + return; + + this._currentPresence = presence; + if (presence == Tp.ConnectionPresenceType.AVAILABLE) this._presence.setStatus(GnomeSession.PresenceStatus.AVAILABLE);